//
//  GuidConnectViewController.m
// 
//
//  Created by apple  on 2017/8/28.
//  Copyright © 2017年 金拇指. All rights reserved.
//

#import "GuidConnectViewController.h"

@interface GuidConnectViewController ()

@property (nonatomic, strong) UIWebView *webView;

@end

@implementation GuidConnectViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationController.navigationBarHidden = NO;
    self.view.backgroundColor = [UIColor hexColor:@"63B8FF"];
    
    self.navigationController.title = @"连接教程";
    
    UILabel *setting1 = [UILabel new];
    setting1.textColor = [UIColor whiteColor];
    setting1.text = @"① 进入系统\"设置->无线局域网\"";//@"② 等待标识出现，点击连接"
    [self.view addSubview:setting1];
    [setting1 mas_makeConstraints:^(MASConstraintMaker *make){
        make.top.equalTo(self.view).offset(30);
        make.leftMargin.offset(50);
    }];
    
    UILabel *setting2 = [UILabel new];
    setting2.textColor = [UIColor whiteColor];
    setting2.text = @"② 等待标识出现，点击连接";
    [self.view addSubview:setting2];
    [setting2 mas_makeConstraints:^(MASConstraintMaker *make){
        make.top.equalTo(setting1.mas_bottom).offset(10);
        make.leftMargin.offset(50);
    }];
 
    NSString *path = [[NSBundle mainBundle] pathForResource:@"wifi_setting" ofType:@"gif"];
    NSData *gifData = [NSData dataWithContentsOfFile:path];
    _webView = [[UIWebView alloc] init];
    _webView.scalesPageToFit = YES;
    [_webView loadData:gifData MIMEType:@"image/gif" textEncodingName:nil baseURL:nil];
    _webView.backgroundColor = [UIColor clearColor];
    _webView.opaque = NO;
    [self.view addSubview:_webView];
    [_webView mas_makeConstraints:^(MASConstraintMaker *make){
        make.top.equalTo(setting2.mas_bottom).offset(20);
        make.centerX.equalTo(self.view.mas_centerX);
        make.width.offset(ScreenW - 100);
        make.height.offset(ScreenH - 300);
    }];
    
    UIButton *noteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    noteBtn.backgroundColor = [UIColor whiteColor];
    [noteBtn setTitle:@"我知道了" forState:UIControlStateNormal];
    [noteBtn setTitleColor:[UIColor hexColor:@"63B8FF"] forState:UIControlStateNormal];
    noteBtn.layer.cornerRadius = 20;
    [noteBtn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:noteBtn];
    [noteBtn mas_makeConstraints:^(MASConstraintMaker *make){
        make.bottom.equalTo(self.view.mas_bottom).offset(-20);
        make.centerX.equalTo(self.view.mas_centerX);
        make.width.offset(ScreenW/2);
        make.height.offset(40);
    }];

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)goBack
{
//    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
    [self.navigationController popViewControllerAnimated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
